package g_commonsio;

import org.apache.commons.io.IOUtils;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;

/**
 * @author Cheng-02
 * @version V1.0
 * @Package g_commonsio
 * @date 2024/4/14 下午2:38
 */
public class Test01 {
    public static void main(String[] args) {

        try {
            //        -静态方法：IOUtils.copy(InputStream in，outputstream out)传递字节流，实现文件复制

            IOUtils.copy(new FileInputStream("module11\\1.txt"),new FileOutputStream("D:\\images\\ves.txt"));//文档的复制
            //                -静态方法：IOUtils.closeQuietly(任意流对象)悄悄的释放资源，自动处理close()方法抛出的异常
            FileWriter fileWriter=new FileWriter("module11\\\\1.txt",true);
            fileWriter.write("az");
            fileWriter.close();



        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
